<template>
  <el-dialog :title="title"
             :visible.sync="dialogData.show"
             center
             fullscreen
             @close="$emit('closedialog')">
    <el-form :model="form"
             label-position="right"
             label-width="120px">

      <el-form-item label="服务图片：">
        <img v-if="form.serviceDoctor"
             :src="form.serviceDoctor.headImageUrl"
             alt=""
             srcset=""
             style="height:178px;width:178px;border:1px solid #999999;">
      </el-form-item>
      <el-form-item label="服务名称：">
        <el-form :inline="true"
                 :model="form"
                 class="demo-form-inline"
                 label-width="100px">
          <el-form-item label="">
            <p style='width:150px'>{{form.name}}</p>
          </el-form-item>
          <el-form-item label="服务价格：">
            <p style='width:150px'>{{form.price}}</p>
          </el-form-item>
          <el-form-item label="挂号费：">
            <p style='width:150px'>{{form.registerPrice}}</p>
          </el-form-item>
          <el-form-item label="订单编号：">
            <p style='width:150px'
               v-if="form.orderInfoDto">{{form.orderInfoDto.orderNumber}}</p>
          </el-form-item>
        </el-form>
      </el-form-item>
      <el-form-item label="患者姓名：">
        <el-form :inline="true"
                 :model="form"
                 class="demo-form-inline"
                 label-width="100px">
          <el-form-item label="">
            <p style='width:150px'
               v-if="form.member">{{form.member.name}}</p>
          </el-form-item>
          <el-form-item label="性别：">
            <p style='width:150px'
               v-if="form.member">{{form.member.sex ==1 ?'男':'女'}}</p>
          </el-form-item>
          <el-form-item label="联系电话：">
            <p style='width:150px'
               v-if="form.member">{{form.member.phone}}</p>
          </el-form-item>
          <el-form-item label="身份证号：">
            <p style='width:150px'
               v-if="form.member">{{form.member.idCard}}</p>
          </el-form-item>
        </el-form>
      </el-form-item>
      <el-form-item label="下单日期：">
        <el-form :inline="true"
                 :model="form"
                 class="demo-form-inline"
                 label-width="100px">
          <el-form-item label="">
            <p style='width:150px'>{{form.createTime}}</p>
          </el-form-item>
          <el-form-item label="预约科室：">
            <p style='width:150px'
               v-if="form.serviceDoctor">{{form.serviceDoctor.deptName}}</p>
          </el-form-item>
          <el-form-item label="预约医生：">
            <p style='width:150px'
               v-if="form.serviceDoctor">{{form.serviceDoctor.name}}</p>
          </el-form-item>
          <el-form-item label="预约时间：">
            <p style='width:150px'>{{form.reserveDate}}</p>
          </el-form-item>
        </el-form>
      </el-form-item>
      <el-form-item label="服务内容："
                    v-if="form.quickConsultationDto">
        <el-input v-model="form.quickConsultationDto.content"
                  disabled
                  type="textarea"
                  maxlength="200"
                  :autosize="{ minRows: 4, maxRows: 4}"
                  show-word-limit
                  autocomplete="off"
                  style="width:50%"></el-input>
      </el-form-item>

      <el-form-item label="服务流程："
                    v-if="form.quickConsultationDto">
        <el-input v-model="form.quickConsultationDto.introduce"
                  disabled
                  type="textarea"
                  maxlength="200"
                  :autosize="{ minRows: 4, maxRows: 4}"
                  show-word-limit
                  autocomplete="off"
                  style="width:50%"></el-input>
      </el-form-item>
      <el-form-item label="订单状态：">
        <span v-if="form.orderInfoDto">{{form.orderInfoDto.orderStatus == 3 ?'未挂号':'已挂号'}}</span>
      </el-form-item>
      <el-form-item label="服务医院：">
        <span v-if="form.serviceDoctor">{{form.serviceDoctor.hospitalName}}</span>
      </el-form-item>
    </el-form>
    <div slot="footer"
         class="dialog-footer">
      <el-button @click="$emit('closedialog')">返 回</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  props: ['dialogData'],
  data () {
    return {
      form: {},
      editObj: {
        imageUrl: null
      },
      imageUploadUrl: this.api.hospitalManager.uploadImg,
      radio: '',
      title: '快诊订单详情'
    }
  },
  methods: {
    handleAvatarSuccess (res) {
      this.editObj.imageUrl = res.data;
    },
    beforeAvatarUpload (file) {
      const isLt2M = file.size / 1024 / 1024 < 2;
      if (!isLt2M) {
        this.$message.error('上传头像图片大小不能超过 2MB!');
      }
      return isLt2M;
    },
  },
  mounted () {
    // this.form = this.dialogData.info
    this.post(this.api.cooperationHospital.getDetail, { "orderId": this.dialogData.info.orderId }).then((res) => {
      this.form = res.data.object
    });

  }
};
</script>

<style>
.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.avatar-uploader .el-upload:hover {
  border-color: #409eff;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}
.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>
